home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1994 November / Cd Ware (Nro. 2) - Epimundo.iso / DOS / PG / RES101.ZIP / RES.DOC < prev    next >
Encoding:
Text File  |  1994-05-15  |  22.4 KB  |  499 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.                        RES version 1.01 Documentation
  7.                                 15 May 1994
  8.  
  9.                         RES software and manual are
  10.                Copyright (c) 1993-1994 by Matthew Hildebrand.
  11.                             All rights reserved.
  12.  
  13.  
  14.  
  15.  
  16. Topics covered in this document:
  17. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  18.  
  19.      INTRODUCTION
  20.      TERMS OF USAGE AND DISTRIBUTION
  21.      WHY REGISTER?
  22.      PACKING LIST
  23.      USING RES.EXE, THE RESOURCE MANAGER
  24.      USING RES IN A PROGRAM
  25.      THE RES FUNCTION LIBRARY
  26.      ADDITIONAL FEATURES IN THE REGISTERED VERSION
  27.      CONTACTING THE AUTHOR
  28.      OBTAINING THE NEWEST VERSION OF RES
  29.      KNOWN PROBLEMS USING RES
  30.      LEGAL STUFF
  31.  
  32.  
  33.  
  34.  
  35. INTRODUCTION
  36. ▀▀▀▀▀▀▀▀▀▀▀▀
  37.  
  38.      RES is a package designed to allow C++ developers to use resource
  39.      files in their programs.  A resource file is a file which contains
  40.      several or many files, each of which is easily accessible by a program
  41.      through a resource manager interface.  The advantages of storing data
  42.      files this way are that, in a typical program, the files may be
  43.      accessed more quickly and less disk space will be wasted.  Using
  44.      resource files also makes programs look more professional.
  45.  
  46.      The RES package includes the RES.EXE resource manager program, which
  47.      allows adding, extracting, deleting, and listing of files in
  48.      resources.  The RES package also includes all the source code
  49.      necessary to access data stored in resources from within your own
  50.      programs.
  51.  
  52.  
  53.  
  54. TERMS OF USAGE AND DISTRIBUTION
  55. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  56.  
  57.      RES is not free; it is distributed on a "try before you buy" basis.
  58.      Permission is granted to use RES, for evaluation purposes only, for a
  59.      trial period of up to 30 days.  In order to use RES after the trial
  60.      period, you MUST REGISTER; registration entitles you to free upgrades,
  61.      technical support, royalty-free distribution rights for all software
  62.      written using RES, and a copy of the registered version of RES, which
  63.      includes complete source code.  Failure to register constitutes theft
  64.      and is punishable by law.
  65.  
  66.      By registering a copy of RES, you signify that you have read and
  67.      understood the terms of usage and distribution explained in this
  68.      document, and that you agree to be bound by these terms; you also
  69.      signify that you agree to release the Author (Matthew Hildebrand) from
  70.      all liability associated with the use of RES.
  71.  
  72.      In order to register a copy of RES, send $15 US funds or $20 Canadian
  73.      funds to Matthew Hildebrand at the address listed in the CONTACTING
  74.      THE AUTHOR section of this document.  Payment by money order, cheque,
  75.      or cash is acceptable; currency must be US or Canadian funds.  Users
  76.      outside the USA and Canada, please ensure that cheques are drawn on a
  77.      US or Canadian bank, and that money orders are international if
  78.      necessary.  Also, please send a filled out copy of ORDER.FRM with
  79.      your payment.  Thank you in advance for registering RES; your support
  80.      is what makes its continued growth possible.
  81.  
  82.      Upon receipt of your registration, I will mail you a copy of the
  83.      registered version of RES, which includes complete source code; this
  84.      registered copy of RES may not be distributed in any way.  Once I have
  85.      mailed you a copy of the registered version, you will be considered a
  86.      registered user.  If you are interested in receiving notifications of
  87.      new versions as they are released, or copies of the new versions
  88.      themselves, refer to paragraph two of the OBTAINING THE NEWEST VERSION
  89.      OF RES section.
  90.  
  91.      The privileges granted by purchasing RES may be retracted if the
  92.      copyright notice in RESOURCE.CPP (copyright[]) is modified or removed,
  93.      if any or all of the registered version of RES is distributed in any
  94.      way, or if any or all of RES's source code is distributed as part of a
  95.      software package.
  96.  
  97.      The shareware version of RES may be distributed freely as long as the
  98.      distributed package is complete and its contents are not modified in
  99.      any way, and the distributed package is not sold for profit.
  100.  
  101.  
  102.  
  103. WHY REGISTER?
  104. ▀▀▀▀▀▀▀▀▀▀▀▀▀
  105.  
  106.      You will receive complete source code for the library.  The source
  107.      includes a complete file manipulation class, which would be useful in
  108.      many programs.
  109.  
  110.      Programs built with RES will be able to create resources, as well as
  111.      open existing ones.
  112.  
  113.      You will be legally entitled to use RES in as many programs as you
  114.      want, without royalties.
  115.  
  116.      You will be entitled to free upgrades, technical support, and eternal
  117.      happiness.
  118.  
  119.      You will have the satisfaction of supporting a good product.
  120.  
  121.  
  122.  
  123. PACKING LIST
  124. ▀▀▀▀▀▀▀▀▀▀▀▀
  125.  
  126.      The current version of RES consists of the following files:
  127.  
  128.      \RES\               <DIR>
  129.          RES.DOC                   RES documentation.
  130.          RES.EXE                   RES resource manager.
  131.          REVISION.HST              Revision history.
  132.          ORDER.FRM                 Order form (shareware version only).
  133.          README.NOW                Important information.
  134.          FILE_ID.DIZ               Archive description file used by some
  135.                                      bulletin board systems (shareware
  136.                                      version only).
  137.      \RES\SOURCE\        <DIR>
  138.          ERROR.H                   Error reporter header.
  139.          FILE.H                    File class header.
  140.          PORTABLE.H                Portability header.
  141.          RESOURCE.H                Resource class header.
  142.            (The licensed version contains complete source code.)
  143.      \RES\LIB\           <DIR>
  144.          BCL.BAT                   Borland C++ large model batch file.
  145.          BCL.MAK                   Borland C++ large model makefile.
  146.          BCH.BAT                   Borland C++ huge model batch file.
  147.          BCH.MAK                   Borland C++ huge model makefile.
  148.          GNU.BAT                   GNU C++ batch file.
  149.          GNU.MAK                   GNU C++ makefile.
  150.          GENERAL.BAT               General batch file.
  151.          GENERAL.MAK               General makefile; edit to suit other
  152.                                      compilers.
  153.          BCL.LIB                   Borland C++ large model library.
  154.          BCH.LIB                   Borland C++ huge model library.
  155.          GNU.A                     GNU C++ library.
  156.  
  157.  
  158.  
  159. USING RES.EXE, THE RESOURCE MANAGER
  160. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  161.  
  162.      RES includes a simple resource file manager, RES.EXE.  This program
  163.      can add, delete, extract, and list files in resource files.  RES.EXE
  164.      has a simple, case-insensitive command-line syntax:
  165.  
  166.               RES <command> <resource_name> [<file_names>...]
  167.  
  168.      <command> must be 'A' (add), 'D' (delete), 'E' (extract), or 'L'
  169.      (list).  <resource_name> is the filename of the resource; the .RES
  170.      extension is assumed if none is present.  If there is an error in the
  171.      command line, a brief help screen is displayed.  Some examples follow:
  172.  
  173.           res a foo graphics\*.*
  174.           res D bar *.obj
  175.           res a foobar.res tom.* dick?.pcx d:\someprog\miscdata\harry*.*
  176.           res l foo *.txt
  177.           res e bar.res *.cpp *.c *.h
  178.  
  179.      Resource files created with RES.EXE may be accessed using a simple
  180.      interface.  How to use RES in a program is detailed in the next two
  181.      sections.
  182.  
  183.      
  184.  
  185. USING RES IN A PROGRAM
  186. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  187.  
  188.      Before using RES for the first time, you should locate the library
  189.      suitable for use with your compiler; libraries may be found in the LIB
  190.      directory.  Following is a list of libraries and the compilers with
  191.      which to use them:
  192.  
  193.           BCL.LIB        Borland C++ large model.
  194.           BCH.LIB        Borland C++ huge model.
  195.           GNU.A          GNU C++.
  196.  
  197.      RES has only been compiled for Borland C++ and GNU C++, simply because
  198.      these are the only C++ compilers I own.
  199.  
  200.      Now, to use the RES resource management function library, all you must
  201.      do is ensure that (a) you #include the RESOURCE.H file (in the SOURCE
  202.      directory) in any module which uses these functions, and that (b) you
  203.      link the appropriate library during the linking stage.
  204.  
  205.  
  206.  
  207. THE RES FUNCTION LIBRARY
  208. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  209.  
  210.      A description of each of the resource management functions,
  211.      implemented through the Resource class, follows:
  212.  
  213.  
  214.          Function:  Resource::open
  215.           Purpose:  Open a resource.
  216.            Syntax:  int Resource::open(char *filename);
  217.        Parameters:  The resource 'filename' will be opened.
  218.           Remarks:  The shareware version of RES does not allow this
  219.                     function to create new resources; it can only open
  220.                     existing resources created by RES.EXE.
  221.           Returns:  Returns 0 on error.
  222.          See also:  None.
  223.  
  224.          Function:  Resource::add
  225.           Purpose:  Add a file to the resource.
  226.            Syntax:  int Resource::add(char *filename);
  227.        Parameters:  The file 'filename' will be added.
  228.           Remarks:  - For speed considerations, the file will not actually
  229.                       be added to the resource file until Resource::pack()
  230.                       is called; this may be done either explicitly or
  231.                       automatically by the Resource class destructor.  A
  232.                       record of the addition will be made, but since the
  233.                       file is not actually added, it is important to ensure
  234.                       that, until Resource::pack() is called, the stated
  235.                       file is not deleted and that no attempt is made to
  236.                       access it through the resource.
  237.                     - If the file already exists in the resource, it will
  238.                       be overwritten.
  239.           Returns:  Returns 0 on error.
  240.          See also:  None.
  241.  
  242.          Function:  Resource::del
  243.           Purpose:  Delete a file from the resource.
  244.            Syntax:  int Resource::del(char *filename);
  245.        Parameters:  The file 'filename' will be deleted from the resource.
  246.           Remarks:  For speed considerations, the file will not actually be
  247.                     deleted from the resource file until Resource::pack() is
  248.                     called; this may be done either explicitly or
  249.                     automatically by the Resource class destructor.
  250.           Returns:  Returns 0 on error.
  251.          See also:  None.
  252.  
  253.          Function:  Resource::extract
  254.           Purpose:  Extract a file from the resource.
  255.            Syntax:  int Resource::extract(char *filename, char
  256.                     *outputPath=NULL);
  257.        Parameters:  The file 'filename' will be extracted into the current
  258.                     directory if 'outputPath' has its default value of
  259.                     NULL; if it has a different value, the string it points
  260.                     to will be prepended to the name of the file, and the
  261.                     resulting string will be used as the name of the output
  262.                     file.  For example, if 'outputPath' points to "D:\",
  263.                     then FILENAME.EXT will be extracted to D:\FILENAME.EXT.
  264.                     Note that the trailing backslash in the path is
  265.                     necessary.
  266.           Remarks:  If the file exists, it will be overwritten.
  267.           Returns:  Returns 0 on error.
  268.          See also:  None.
  269.  
  270.          Function:  Resource::load
  271.           Purpose:  Load some or all of a file from the resource.
  272.            Syntax:  void _far *Resource::load(char *file, void _far
  273.                     *buf=NULL, biguint numBytes=0, bigint startOff=-1);
  274.        Parameters:  Based on other parameters, some or all of 'file' will
  275.                     be loaded.  'startOff' determines the offset into the
  276.                     file of the first byte to load.  As with the standard
  277.                     FILE*s, the current offset into each file is
  278.                     maintained; the default value of -1 will cause the use
  279.                     of the current offset, or an offset may be explicitly
  280.                     stated.  'numBytes' determines how much data will be
  281.                     loaded; the default of 0 will cause the loading of all
  282.                     data from 'startOff' to end-of-file, or a value may be
  283.                     explicitly stated.  'buf' determines the address into
  284.                     which the data will be loaded; the default value of
  285.                     NULL will cause a block of memory of the correct size
  286.                     to be allocated (remember to free it later), or an
  287.                     address may be explicitly stated.
  288.           Remarks:  - This function can be confusing; see the examples
  289.                       below.
  290.                     - If this function is instructed to allocate a new
  291.                       buffer, and the allocation fails, then the program
  292.                       will exit.  Licensed users may change this behaviour.
  293.           Returns:  Returns NULL on error, or the address of the loaded
  294.                     data on success.
  295.          See also:  None.
  296.          Examples:  // Load all of FOOBAR.DAT into a new buffer
  297.                     addr = res.load("foobar.dat");
  298.                     // Load all of FOOBAR.DAT into an old buffer
  299.                     res.load("foobar.dat", addr);
  300.                     // Load the first kb of FOOBAR.DAT into an old buffer
  301.                     res.load("foobar.dat", addr, 1024);
  302.                     // Load the second kb of FOOBAR.DAT into a new buffer
  303.                     addr = res.load("foobar.dat", NULL, 1024, 1024);
  304.  
  305.          Function:  Resource::pack
  306.           Purpose:  Update a resource file, implementing any deletions and
  307.                     additions.
  308.            Syntax:  int Resource::pack(void);
  309.        Parameters:  N/A
  310.           Remarks:  This function has no effect if there have been no
  311.                     additions and/or deletions to/from the resource.
  312.           Returns:  Returns 0 on error.
  313.          See also:  None.
  314.  
  315.          Function:  Resource::rewind
  316.           Purpose:  Reset a file's current offset to beginning-of-file.
  317.            Syntax:  int Resource::rewind(char *filename);
  318.        Parameters:  The file 'filename' will be rewound.
  319.           Remarks:  None.
  320.           Returns:  Returns 0 on error (ie. if the file does not exist in
  321.                     the resource).
  322.          See also:  Resource::seek()
  323.  
  324.          Function:  Resource::seek
  325.           Purpose:  Reset a file's current offset to a specified value,
  326.                     fseek()-style.
  327.            Syntax:  int Resource::seek(char *filename, bigint offset, int
  328.                     whence);
  329.        Parameters:  The current offset of 'filename' will be changed.
  330.                     'whence' determines the point from which the offset
  331.                     will be reckoned; use SEEK_SET (0) for file beginning,
  332.                     SEEK_CUR (1) for current position, or SEEK_END (2) for
  333.                     end-of-file.  The pointer will be moved to a position
  334.                     which is 'offset' bytes from the location given by
  335.                     'whence'; 'offset' may be negative.
  336.           Remarks:  This function is used in the same way as fseek().
  337.           Returns:  Returns 0 on error.
  338.          See also:  Resource::rewind()
  339.  
  340.          Function:  Resource::fileSize
  341.           Purpose:  Return the size of a file in the resource.
  342.            Syntax:  biguint Resource::fileSize(char *filename);
  343.        Parameters:  The size of 'filename' will be returned.
  344.           Remarks:  None.
  345.           Returns:  Returns 0 on error, or the size of the file on success.
  346.          See also:  None.
  347.  
  348.          Function:  Resource::exists
  349.           Purpose:  Return a flag indicating whether or not the resource
  350.                     exists on disk, or whether it is newly created and
  351.                     Resource::pack() has not yet been called to write it to
  352.                     disk.
  353.            Syntax:  int Resource::exists(void);
  354.        Parameters:  None.
  355.           Remarks:  None.
  356.           Returns:  Returns 0 if the resource does not exist on disk, or
  357.                     non-zero if it does.
  358.          See also:  None.
  359.  
  360.          Function:  Resource::status
  361.           Purpose:  Returns an indication of how many errors have occurred
  362.                     in accessing the resource.
  363.            Syntax:  int Resource::status(void);
  364.        Parameters:  None.
  365.           Remarks:  None.
  366.           Returns:  Returns the number of errors which have occurred in
  367.                     accessing the resource since the last call to this
  368.                     function or the opening of the resource, whichever is
  369.                     most recent.
  370.          See also:  None.
  371.  
  372.  
  373.  
  374. ADDITIONAL FEATURES IN THE REGISTERED VERSION
  375. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  376.  
  377.      In addition to technical support and usage rights, registered users
  378.      may use the registered version of RES.  Not only does the registered
  379.      version of RES include complete source code for the RES library, it
  380.      also includes a feature not available in the shareware verion:
  381.  
  382.      Programs built with RES will be allowed to create resources, as well
  383.      as opening existing resources created with RES.EXE.  In order to allow
  384.      creation of resources, comment out the definition of NO_CREATE on line
  385.      16 of RESOURCE.CPP, then recompile the library using the appropriate
  386.      batch file in the LIB directory; uncommenting the line and recompiling
  387.      will once again cause RES to not create resources.
  388.  
  389.  
  390.  
  391. CONTACTING THE AUTHOR
  392. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  393.  
  394.      I would appreciate hearing any questions, comments, bug reports, or
  395.      suggestions for improvement.  If you have any, feel free to contact
  396.      me; I can be reached via any of the methods below.  When reporting
  397.      bugs, please be sure to mention the version of RES to which you are
  398.      referring.
  399.  
  400.           Snail mail:      Matthew Hildebrand
  401.                            4 College St.
  402.                            St. Catharines, ON
  403.                            Canada
  404.                            L2R 2W7
  405.  
  406.           Fidonet mail:    1:247/128.2
  407.                Please do not post personal messages to me in any of the
  408.                Fidonet echos, such as C_ECHO or C_PLUSPLUS; such messages
  409.                are off-topic and liable to annoy the moderator and other
  410.                echo participants.  Use netmail instead.  If I find any such
  411.                personal messages in Fidonet programming echos, I reply by
  412.                netmail only.  If the matter being discussed would be of
  413.                interest to other echo participants, I will reply in that
  414.                echo.
  415.  
  416.           Internet mail:   Matthew.Hildebrand@p2.f128.n247.z1.fidonet.org
  417.                Internet-Fidonet mail routing sometimes goes awry; if you
  418.                don't get a reply from me after a reasonable amount of time,
  419.                send the message again.  If you still don't receive a reply,
  420.                either persist until you do or contact me via a different
  421.                method.
  422.  
  423.           BBS:             (905)-935-6628
  424.                I am not the sysop of idiot savant BBS, but I will receive
  425.                messages left there for me.  The BBS runs a 14400 bps
  426.                V.32bis modem.
  427.  
  428.           Telephone:       (905)-687-8736
  429.                Please keep in mind the time zone difference, if any, when
  430.                calling; I'm in Eastern Standard Time.
  431.  
  432.  
  433.  
  434. OBTAINING THE NEWEST VERSION OF RES
  435. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  436.  
  437.      The most recent distributed copy of RES is available via first-call
  438.      download from (905)-935-6628 (14400 bps V.32bis), or via file request
  439.      from Fidonet node 1:247/128 (14400 bps V.32bis) using the magic file
  440.      name "RES"; unlisted nodes and points are welcome.  RES is also
  441.      distributed through the Fidonet file echo PDNCEE.
  442.  
  443.      If, after you have registered, you are interested in receiving new
  444.      versions of RES as they are released, an easy method is now available.
  445.      For $3 per mailing (to cover the disk, envelope, and postage), I will
  446.      mail copies of new versions as they are released, on either a 3.5" or
  447.      a 5.25" disk.  The $3 per mailing may be included with the initial
  448.      registration fee, with instructions to mail newer versions as they are
  449.      released, or mailed later with a request for a copy of the newest
  450.      version.  Please ensure that the $3 is paid in either US or Canadian
  451.      funds; payment by cash, money order (use an international money order
  452.      if necessary), or cheque drawn on a US or Canadian bank is acceptable.
  453.  
  454.      Alternatively, it is possible to receive notifications of updates but
  455.      not the updates themselves.  For $1 per mailing (to cover the envelope
  456.      and postage), I will mail notifications of new versions when they are
  457.      released.  The $1 per mailing may be included with the initial
  458.      registration fee, with instructions to mail notifications as new
  459.      versions are released, or mailed later with similar instructions.
  460.      Again, please ensure that the $1 is paid in either US or Canadian
  461.      funds; payment by cash, money order (use an international money order
  462.      if necessary), or cheque drawn on a US or Canadian bank is acceptable.
  463.  
  464.  
  465.  
  466. KNOWN PROBLEMS USING RES
  467. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  468.  
  469.      Borland C++ users should either have the "Unsigned characters" option
  470.      disabled, or be prepared to frequently cast to type char.  Though
  471.      unlikely, it may also be necessary to enable the "Far virtual tables"
  472.      option.
  473.  
  474.  
  475.  
  476. LEGAL STUFF
  477. ▀▀▀▀▀▀▀▀▀▀▀
  478.  
  479.      RES and its documentation are Copyright (c) 1993-1994 by Matthew
  480.      Hildebrand.
  481.  
  482.      All software and documentation associated with RES is provided "as
  483.      is":  ie., it is provided without warranty of any kind, not even an
  484.      implied warranty of merchantability or fitness for any purpose.  The
  485.      Author (Matthew Hildebrand) disclaims all warranties, both express and
  486.      implied, including but not limited to warranties regarding RES's
  487.      merchantability or fitness for any particular purpose.
  488.  
  489.      The author may not be held liable for any damage or misfortune related
  490.      to the use of this software.  Any usage of any or all of RES is done
  491.      entirely at the user's risk.
  492.  
  493.      All registered trademarks in this document belong to their respective
  494.      owners.
  495.  
  496.  
  497.  
  498. End of document.
  499.